<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>欢迎</title>
    <script src="js/jquery-1.12.4.js"></script>
     <script src="js/vue.js"></script>
</head>
<body>
    <div id="app">
        <h1>好好学习，天天向上</h1>
        <h3>欢迎，{{user.name}} {{user.sex=='男'?'先生':'女士'}}</h3>
    </div>

    <script>
        new Vue({
            el:'#app',
            data:{
               user:{}
            },
            mounted:function() {
                this.user = JSON.parse(sessionStorage.getItem("user"));
                if(this.user==null) {
                    location.href = 'login.html' ;
                }
            }
        });
    </script>
</body>
</html>